#ifndef IINTERFACE_H
#define IINTERFACE_H

#include "QWidget"
#include "globalParameter.h"
#include <QTextCodec>
#include "qpushbutton.h"
#include "QLabel"
#include <QString>

namespace interface
{
class IInterface : public QWidget
{
    Q_OBJECT

public:
    IInterface(QWidget *parent)
        :QWidget(parent)
    {
        // set the font format to Chinese
        gbk = QTextCodec::codecForName("GBK");
        QTextCodec::setCodecForCStrings(gbk);
    }

    virtual ~IInterface(){}

protected:
    // functions that will be used to paint the background
    void SetupBackground(QString path);
    void SetupBtn(QPushButton * bnt, QString picPath);
    void SetupLabel(QLabel * label, QString picPath);

signals:
    // this signal will be sent when we want to change the interface
    void changeInterfaces(interface::InterfaceRequestEnum from, \
                          interface::InterfaceRequestEnum to, \
                          void* p);

    // the following change is for chinese output
protected:
    QTextCodec* gbk;

    QString mytr(const char * chars)
    {
        return gbk->toUnicode(chars,strlen(chars));
    }
};
}
#endif // IINTERFACE_H
